#include <stdio.h>
#include <stdlib.h>
typedef struct Student
{
	int id;
	char sex;
	int age;
	char* name;
	struct Student* next;
} Student;

typedef struct LinkedList
{
	 Student* list;
} LinkedList;

Student* getNode()
{
	static Student* node;
	node = malloc(sizeof(Student));
	node->next = NULL;
	return node;
}

void del(LinkedList* linkedList, int age)
{
	Student* now, * last;
	now = linkedList->list;
	last = NULL;
	while (now != NULL)
	{
		if (now->age == age)
		{
			if (last == NULL)
			{
				linkedList->list = now->next;
				free(now);
				now = linkedList->list;
			}
			else
			{
				last->next = now->next;
				free(now);
				now = last->next;
				continue;
			}
		}
		last = now;
		now = now->next;
	}
}
int main()
{
	LinkedList* linkedList;
	linkedList = malloc(sizeof(LinkedList));
	linkedList->list = NULL;
	for (int i = 0; i < 10; i++)
	{
		Student* now;
		now = getNode();
		now->age = i;
		if (linkedList->list == NULL)
		{
			linkedList->list = now;
			continue;
		}
		now->next = linkedList->list;
		linkedList->list = now;
	}
	del(linkedList, 9);

	while (linkedList->list != NULL)
	{
		printf("%d\n", linkedList->list->age);
		linkedList->list = linkedList->list->next;
	}
}